//
//  UIImage+Extension.h
//  SkyEyes
//
//  Created by LexLee on 11/21/13.
//  Copyright (c) 2013 AsiaInfo-LinkAge. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <Accelerate/Accelerate.h>

@interface UIImage (CS_Extensions)

// 图像裁剪
-(UIImage *)imageAtRect:(CGRect)rect;

// 圆角矩形裁剪图片
- (UIImage *)roundRectImage:(CGFloat)roundCorner;

// 合并两张图片
- (UIImage *)mergerImage:(UIImage *) image;

// 裁剪圆形图片
- (UIImage*)circleImage;

// 修正拍照后图片旋转问题
- (UIImage *)fixOrientation;

// 给图片添加文字水印
-(UIImage *)addText:(NSString *)text postion:(CGPoint)point;

//截取部分图像
-(UIImage*)getSubImage:(CGRect)rect;

//等比例缩放
-(UIImage*)scaleToSize:(CGSize)size;
-(UIImage*)scaleToSize:(CGSize)size originalSize:(BOOL)originalSize; 
//居中裁剪图片
- (UIImage *)thumbnailWithSize:(CGSize)asize;
- (UIImage *)thumbnailImageForSquare;
// 创建图片毛玻璃效果
-(UIImage *)boxblurImageWithBlur:(CGFloat)blur;

+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;
//loading photo
+(UIImage*)loadingImageWithImage:(UIImage *)image size:(CGSize)size;


+ (UIImage*)resizableImage:(NSString*)imgName edge:(UIEdgeInsets)edge;
+ (UIImage*)resizableContentImage:(UIImage*)contentImage edge:(UIEdgeInsets)edge;

//---------------------------
#pragma mark - 毛玻璃
- (UIImage *)applyLightEffect;     //普通毛玻璃
- (UIImage *)applyExtraLightEffect;//白色背景毛玻璃
- (UIImage *)applyDarkEffect;       //黑色北京毛玻璃
- (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor;
- (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;

@end;